{{template Elements/header_content}}
    <div class="row">
    	<div class="col-xs-12">
      		<div class="wx-cover-item  noborder">
      			{{$this->Html->image($wxinfo['Wx']['coverimg'])}}
	       		<!-- <div class="cover" style="background-image:url({{$this->Html->image($wxinfo['Wx']['coverimg'],array('onlyurl'=>true))}});"></div> -->
				<h4 style="background:none;">{{__('Choose a property')}}</h4>
			</div>
		</div>
      {{loop $datalist $item}}
      	<div class="col-xs-12">
      		<a class="item-city" id="item-city-{{$item['WxCity']['city_id']}}" data-wxid="{{$wx_id}}" data-cityid="{{$item['WxCity']['city_id']}}" href="{{$this->Html->url('/wx_cities/view/'.$wx_id.'/'.$item['WxCity']['city_id'])}}">
      		<div class="wx-cover-item">
      			<img src="{{$this->Html->image($item['WxCity']['coverimg'],array('onlyurl'=>true))}}">
	       		<!-- <div class="cover" style="background-image:url({{$this->Html->image($item['WxCity']['coverimg'],array('onlyurl'=>true))}});"></div> -->
	       		<h4>{{$item['City']['name']}} <i class="fa fa-angle-right pull-right"></i></h4>
      		</div>
      		</a>
      	</div>
 		{{/loop}}
   	</div>
<script>
$(function(){	
	$(window).resize(function(){
		var size = $('.wx-cover-item').size(); 
		var height = $(window).height() - 32 - 6*size; //each has six border.
		$('.wx-cover-item .cover').height( height/size );
	}).trigger('resize');
	
	$('.item-city').click(function(){
		$('.item-city').removeClass('selected-item-city');
		$('.item-city .selected-city').remove();
		var cityid = $(this).data('cityid');
		$('#item-city-'+cityid).addClass('selected-item-city').append('<div class="selected-city"><span class="left-caret"></span><span class="txt">{{__("Selected")}}</span></div>');
		
		$.cookie('cityid',cityid,{path:'/'});
		return true;
	});
	
	var cityid = $.cookie('cityid');
	if(cityid && cityid != "null") {
		$('#item-city-'+cityid).addClass('selected-item-city').append('<div class="selected-city"><span class="left-caret"></span><span class="txt">{{__("Selected")}}</span></div>');
	}
})
</script>
